var FM_svgUtils = Class.create();
FM_svgUtils.prototype = {
    initialize: function() { },
    type: 'FM_svgUtils',
    format: function(){
        var args = arguments;
        var utility = this;
        return args[0].replace(/{(\d+)}/g, function(match, number) {
            number++;
            if (args[number] != 'undefined') {

                var arg = args[number],
                    isArgANumber = !isNaN(parseFloat(arg)) && isFinite(arg);
                
                return  isArgANumber ? utility.toFixed(arg) : arg;

            } else {

                return match;
            }
        });
    },
    toFixed: function(x) {
        var e;

        if (Math.abs(x) < 1.0) {

            e = parseInt(x.toString().split('e-')[1]);
            
            if (e) {

                x *= Math.pow(10, e - 1);
                var pos = x.toString().indexOf('.') + 1,
                    pre = x.toString().substr(0, pos);

                x = pre + (new Array(e + 1)).join('0') + x.toString().substring(pos);
            }

        } else {

            e = parseInt(x.toString().split('+')[1]);

            if (e > 20) {

                e -= 20;
                x /= Math.pow(10, e);
                x += (new Array(e + 1)).join('0');

            }

        }

        return x;
    
    }
};